﻿@{
    ViewData["Title"] = "用户角色管理";
}

<div class="panel panel-default">
    <div class="form-content">
        <div class="form-body col-md-6">
            <div class="row" id="userFilter" data-toggle="form" data-field="User" data-grid="#userGrid" data-filterable="true">
                <input data-field="name,userName" placeholder="请输入 姓名/用户名 模糊查询" data-size="6,0,12" data-logic="or" data-operator="contains" />
                <button data-button="query">查询</button>
                <button data-button="clear">清除条件</button>
            </div>
            <div id="userGrid" data-toggle="grid" data-form="#userFilter" node="grid" data-changed="#:userSelect">
                <div node="columns" node-type="array">
                    <span data-field="image" data-title="用户图片" data-type="image"></span>
                    <span data-field="userName" data-title="用户名"></span>
                    <span data-field="name" data-title="用户姓名"></span>
                    <span data-field="alias" data-title="昵称/别名"></span>
                    <span data-field="type" data-title="用户类型" data-data-from="cache.authorizeType"></span>
                    <span data-field="group.name" data-title="用户直属单位"></span>
                    <span data-field="phoneNumber" data-title="手机号码"></span>
                    <span data-field="email" data-title="邮箱" data-hidden="true"></span>
                    <span data-field="description" data-title="备注说明" data-hidden="true"></span>
                    <span data-field="state" data-title="状态" data-data-from="cache.dataState" data-hidden="true"></span>
                    <span data-field="createdOn" data-title="创建时间" data-type="datetime" data-hidden="true"></span>
                </div>
                <span node="dataSource">
                    <span node="transport">
                        <span node="read" data-url="/odata/Users?$select=id,name,userName,alias,type,image,phoneNumber,email,state,createdOn,description&$expand=group($select=id,name)">
                        </span>
                    </span>
                    <span node="sort" data-field="userName" data-dir="asc"></span>
                </span>
            </div>
        </div>
        <div class="form-body col-md-6">
            <div class="row" id="assginFilter" data-toggle="form" data-field="Role" data-grid="#assginGrid" data-filterable="true">
                <input data-field="name" placeholder="请输入 角色名称 模糊查询" data-size="6,0,12" data-logic="or" data-operator="contains" />
                <button data-button="query">查询</button>
                <button data-button="clear">清除条件</button>
                <button data-button="apply" data-url="/api/users/ChangeUserRoles" data-with-form-data="false" data-before-submit="#:userChangeAssign" data-confirm="true" data-prompt="true">授 权</button>
            </div>
            <div id="assginGrid" data-toggle="grid" data-form="#assginFilter" node="grid" data-selectable="multiple, row" data-changed="#:assginSelect">
                <div node="columns" node-type="array">
                    <span data-field="image" data-title="角色图片" data-type="image"></span>
                    <span data-field="name" data-title="角色名称"></span>
                    <span data-field="alias" data-title="昵称/别名"></span>
                    <span data-field="type" data-title="角色类型" data-data-from="cache.authorizeType"></span>
                    <span data-field="description" data-title="备注说明" data-hidden="true"></span>
                    <span data-field="state" data-title="状态" data-data-from="cache.dataState" data-hidden="true"></span>
                    <span data-field="createdOn" data-title="创建时间" data-type="datetime" data-hidden="true"></span>
                </div>
                <span node="dataSource">
                    <span node="transport">
                        <span node="read" data-url="/odata/Roles">
                        </span>
                    </span>
                    <span node="sort" data-field="name" data-dir="asc"></span>
                </span>
            </div>
        </div>
    </div>
</div>

<script src=~/js/userSelect.js asp-append-version="true"></script>